package cn.wolfcode.rbac.exception;

import cn.wolfcode.rbac.enums.BizExceptionEnum;
import lombok.Data;

/**
 * @author Lu.F
 * @version 1.0
 * @Description TODO
 * @date 2022/5/14 16:01
 * 自定义异常错误
 */
@Data
public class CustomException extends RuntimeException{

    /**
     * 错误状态码
     */
    private int code;

    /**
     * 报错消息
     */
    private String msg;

    public CustomException(){

    }

    public CustomException(int code,String msg){
        this.code =code;
        this.msg = msg;
    }

    public CustomException(BizExceptionEnum bizExceptionEnum){
        this.code = bizExceptionEnum.getCode();
        this.msg = bizExceptionEnum.getMsg();
    }
}
